package com.spring.app.common.controller;


import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;


@Controller
@RequestMapping("/auth")
public class LoginLogoutController {
	
//	protected static Logger logger = Logger.getLogger("controller");
	
	
	@RequestMapping(value="/login",method=RequestMethod.GET)
	public String getLoginPage(@RequestParam(value="error", required=false) boolean error, ModelMap model){
		
		if (error == true) {
			 // Assign an error message
			model.put("error", "You have entered an invalid username or password!");
	    }else{
			model.put("error", "");
		}
		
		return "loginpage";
		
	}
	
	
	@RequestMapping(value="/denied",method=RequestMethod.GET)
	public String getDeniedPage(){
		
	//	logger.
		return "deniedpage";
		
	}
	
	@RequestMapping(value="/logout",method=RequestMethod.GET)
	public String getLogoutPage(){
		
	//	logger.
		return "loginpage";
		
	}
	
	

}
